/***********************************************************************************************************
* TNA - The Network Auditor
* Copyright © 2012  Jeff Scaparra -- SPAWAR Systems Center LANT
*
* This file is a part of TNA.
*
* Description:
*
* This defines the packetsniffer for network auditing. This module controls which other modules get which
* packets and the flow of the data in the auditor.
*
***********************************************************************************************************/

#ifndef PACKETSNIFFER_H
#define PACKETSNIFFER_H

#include <Packet/packet.h>
#include <Sniffer/sniffer.h>
#include "tcpserviceportdiscoverer/tcpserviceportdiscoverer.h"
#include <QString>

class PacketSniffer
{
public:
  PacketSniffer();
  void start();
  void setDevice(const std::string &device);
  void setConfFile( const std::string &conf);
  std::string confFile( ) const;
  TCPServicePortDiscoverer* tcpServicePortDiscoverer() { return &tcpServicePortDiscoverer_; }

private:
  void readConf();
  //! Process the line (remove leading and multiple whitespace and remove comments.
  QString processLine( const QString &line );
  QString commentRemover( const QString &line );
  QString whiteSpaceRemover( const QString &line );

  bool enableTcpServicePortDiscoverer_;
  Sniffer sniffer_;
  TCPServicePortDiscoverer tcpServicePortDiscoverer_;
  std::string confFile_;


};

#endif // PACKETSNIFFER_H
